const path = require('path');
const webpack = require('webpack');
const { dllDir } = require('./path');

module.exports = {
  mode: 'production',

  entry: {
    lib: [
      'react',
      'react-dom',
      'react-redux',
      'react-loadable',
      'react-router-dom',
      'prop-types',
      'redux',
      'redux-thunk',
      'history',
      'connected-react-router',
    ],
  },

  output: {
    filename: '[name].js',
    path: dllDir,
    library: '[name]', // 暴露一个全局变量
  },

  plugins: [
    new webpack.DllPlugin({
      name: '[name]',
      path: path.resolve(dllDir, '[name].manifest.json'), // manifest.json文件的绝对路径
    }),
  ],
};
